﻿namespace TheSafety.Management
{
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Threading;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Markup;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class CancelItemNew : UserControl, IComponentConnector
    {
        private EventHandler<RoutedEventArgs> a;
        private SynchronizationContext b;
        internal GroupBox c;
        internal Label d;
        internal Label e;
        internal Label f;
        internal Label g;
        internal Label h;
        internal Label i;
        internal GroupBox j;
        internal Label k;
        internal Label l;
        internal Label m;
        internal Label n;
        internal Button o;
        internal Button p;
        private bool q;
        [CompilerGenerated]
        private string r;
        [CompilerGenerated]
        private string s;

        public CancelItemNew()
        {
            this.InitializeComponent();
            this.a();
        }

        private void a()
        {
            this.k.Content = e.c("Return") + ":";
            this.f.Content = e.c("Expires") + ":";
            this.m.Content = e.c("YourBalance") + ":";
            this.d.Content = e.c("OneSubscribtion") + ":";
            this.e.Content = e.c("VPNUsername") + ":";
            this.p.Content = e.c("Back");
            this.o.Content = e.c("CancelSubscription");
            this.c.Header = e.c("OrderInfo");
            this.j.Header = e.c("Sum");
        }

        public void a(EventHandler<RoutedEventArgs> A_0)
        {
            EventHandler<RoutedEventArgs> handler2;
            EventHandler<RoutedEventArgs> a = this.a;
            do
            {
                handler2 = a;
                EventHandler<RoutedEventArgs> handler3 = (EventHandler<RoutedEventArgs>) Delegate.Remove(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler<RoutedEventArgs>>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        private string a(DateTime A_0)
        {
            TimeSpan span = A_0.Subtract(DateTime.Now);
            return string.Concat(new object[] { span.Days, e.c("d"), " ", span.Hours, e.c("h"), " ", span.Minutes, e.c("m") });
        }

        [CompilerGenerated]
        private void a(object A_0)
        {
            SendOrPostCallback d = null;
            SendOrPostCallback callback2 = null;
            <>c__DisplayClass6 class2;
            string a = "";
            string[] b = new string[2];
            this.b.Send(new SendOrPostCallback(class2.f), null);
            if (!string.IsNullOrWhiteSpace(a))
            {
                MessageBox.Show(a);
            }
            else
            {
                if (d == null)
                {
                    d = new SendOrPostCallback(class2.e);
                }
                this.b.Send(d, null);
                if (callback2 == null)
                {
                    callback2 = new SendOrPostCallback(class2.d);
                }
                this.b.Send(callback2, null);
            }
        }

        private DateTime a(string A_0)
        {
            double result = 0.0;
            double.TryParse(A_0, out result);
            DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0);
            return time.AddSeconds(result);
        }

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    ((CancelItemNew) A_1).Loaded += new RoutedEventHandler(this.UserControl_Loaded);
                    return;

                case 2:
                    this.c = (GroupBox) A_1;
                    return;

                case 3:
                    this.d = (Label) A_1;
                    return;

                case 4:
                    this.e = (Label) A_1;
                    return;

                case 5:
                    this.f = (Label) A_1;
                    return;

                case 6:
                    this.g = (Label) A_1;
                    return;

                case 7:
                    this.h = (Label) A_1;
                    return;

                case 8:
                    this.i = (Label) A_1;
                    return;

                case 9:
                    this.j = (GroupBox) A_1;
                    return;

                case 10:
                    this.k = (Label) A_1;
                    return;

                case 11:
                    this.l = (Label) A_1;
                    return;

                case 12:
                    this.m = (Label) A_1;
                    return;

                case 13:
                    this.n = (Label) A_1;
                    return;

                case 14:
                    this.o = (Button) A_1;
                    this.o.Click += new RoutedEventHandler(this.btnOk_Click);
                    return;

                case 15:
                    this.p = (Button) A_1;
                    this.p.Click += new RoutedEventHandler(this.btnCancel_Click);
                    return;
            }
            this.q = true;
        }

        public void b(EventHandler<RoutedEventArgs> A_0)
        {
            EventHandler<RoutedEventArgs> handler2;
            EventHandler<RoutedEventArgs> a = this.a;
            do
            {
                handler2 = a;
                EventHandler<RoutedEventArgs> handler3 = (EventHandler<RoutedEventArgs>) Delegate.Combine(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler<RoutedEventArgs>>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        private void btnCancel_Click(object A_0, RoutedEventArgs A_1)
        {
            if (this.a != null)
            {
                this.a(A_0, A_1);
            }
        }

        private void btnOk_Click(object A_0, RoutedEventArgs A_1)
        {
            <>c__DisplayClassb classb;
            object b = A_0;
            RoutedEventArgs c = A_1;
            new Thread(new ParameterizedThreadStart(classb.d)) { IsBackground = true }.Start(null);
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.q)
            {
                this.q = true;
                Uri resourceLocator = new Uri("/TheSafety;component/management/cancelitemnew.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }

        private void UserControl_Loaded(object A_0, RoutedEventArgs A_1)
        {
            this.i.Content = this.a(this.c()).ToShortDateString() + " (" + this.a(this.a(this.c())) + ")";
            this.b = SynchronizationContext.Current;
            new Thread(new ParameterizedThreadStart(this.a)) { IsBackground = true }.Start(null);
        }

        public string PropDate
        {
            [CompilerGenerated]
            get
            {
                return this.r;
            }
            [CompilerGenerated]
            set
            {
                this.r = value;
            }
        }

        public string PropOrderID
        {
            [CompilerGenerated]
            get
            {
                return this.s;
            }
            [CompilerGenerated]
            set
            {
                this.s = value;
            }
        }

        public string PropSubscription
        {
            set
            {
                this.g.Content = value;
            }
        }

        public string PropUserName
        {
            set
            {
                if (value == "Account Type")
                {
                    this.e.Visibility = Visibility.Hidden;
                    this.h.Visibility = Visibility.Hidden;
                    this.d.Content = e.c("GUILicense");
                }
                else
                {
                    this.h.Content = value;
                }
            }
        }
    }
}

